package com.example.myapplication;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity  implements MyIntentService.seiviceUpdate {

    Button button;
    MyIntentService myIntentService;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        button=findViewById(R.id.btn);

        myIntentService=new MyIntentService();
        myIntentService.setService(this);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent mIntent=new Intent(MainActivity.this,MyIntentService.class);
                startService(mIntent);
            }
        });


    }

    @Override
    public void upUI(int number) {
        Log.e("MainActivity",number+"");
    }
}